<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>九九乘法表</title>
    <style type="text/css">
        table {
            /*细边框样式，单元格之间没有间隔*/
            border-collapse: collapse;
        }
        td {
            padding: 5px;
        }
        td:hover {
            background-color: yellow;
        }
    </style>
</head>
<body>
    <table border="1">
        <script type="text/javascript">

            //在js中有一个方法：prompt 对话框（输入对话框）
            var num = prompt("请输入乘法表的行数：", "9");

            for (let i = 1; i <= num; i++) {
                document.write("<tr>")
                for (let j = 1; j <= i; j++) {
                    document.write("<td>")
                    document.write(j+"x"+i+"="+(j*i));
                    document.write("</td>")
                }
                document.write("</tr>")
            }
        </script>
    </table>
</body>
</html>